﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Goldlight.Mvvm.Base;
using System.Windows.Input;
using Goldlight.Mvvm.Base.Command;
using System.Windows;
using Goldlight.Mvvm.Interfaces;
using System.ComponentModel.Composition;
using System.Diagnostics;

namespace Goldlight.SampleApplication.ViewModels
{
    [Export(typeof(MenuViewModel))]
    public class MenuViewModel : ViewModelBase
    {
        #region Members
        private LanguageResources.Language _language;
        private ICommand _exitCommand;
        private ICommand _territoriesCommand;
        private ICommand _pricesCommand;
        private ICommand _newContactCommand;
        [Import(typeof(ITaskDialogService))]
        private ITaskDialogService _taskDialog = null;
        #endregion

        /// <summary>
        /// Initialize a new instance of <see cref="MenuViewModel"/>.
        /// </summary>
        public MenuViewModel()
            : base()
        {
            _language = new LanguageResources.Language();
        }

        /// <summary>
        /// Get the resources from the system.
        /// </summary>
        public override object Resources
        {
            get
            {
                return _language;
            }
        }

        public ICommand NewContactCommand
        {
            get
            {
                if (_newContactCommand == null)
                {
                    _newContactCommand = new RelayCommand(()=> Mediator.NotifyColleagues(MediatorMessages.NewContact, this));
                }
                Utility.TaskDialog.Show("Get this");
                return _newContactCommand;
            }
        }

        /// <summary>
        /// Close the application down.
        /// </summary>
        public ICommand ExitCommand
        {
            get
            {
                if (_exitCommand == null)
                    _exitCommand = new RelayCommand(() => Application.Current.Shutdown());
                return _exitCommand;
            }
        }

        public ICommand PricesCommand
        {
            get
            {
                if (_pricesCommand == null)
                    _pricesCommand = new RelayCommand(() => Prices());
                return _pricesCommand;
            }
        }

        public ICommand TerritoriesCommand
        {
            get
            {
                if (_territoriesCommand == null)
                    _territoriesCommand = new RelayCommand(() => { });
                return _territoriesCommand;
            }
        }

        public void Prices()
        {
        }
    }
}
